<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
  <title>公司管理</title>
</head>

<body>
  <c:if test="${not empty message}">
    <div id="message" class="alert alert-success"><button data-dismiss="alert" class="close">×</button>${message}</div>
  </c:if>
  <div class="row">
    <div class="span4 offset7">
      <form class="form-search" action="#">
        <label>名称：</label> <input type="text" name="search_LIKE_name" class="input-medium" value="${param.search_LIKE_name}"> 
        <button type="submit" class="btn" id="search_btn">Search</button>
        </form>
      </div>
      <tags:sort/>
  </div>
  
  <table id="contentTable" class="table table-striped table-bordered table-condensed">
    <thead><tr><th width="40%">公司</th><th width="30%">行业</th><th width="10%">余额</th><th width="20%">管理</th></tr></thead>
    <tbody>
    <c:forEach items="${companys.content}" var="company">
      <tr>
        <td><a href="${ctx}/admin/company/update/${company.id}">${company.name}</a></td>
        <td>${company.industry.name}</td>
        <td>${company.balance}</td>
        <td><a href="${ctx}/admin/company/delete/${company.id}">删除</a>&nbsp;&nbsp;
        <c:choose>
        <c:when test="${company.status == 0}">
            <a href="${ctx}/admin/company/disable/${company.id}">停用</a>&nbsp;&nbsp;
        </c:when>
        <c:otherwise>
            <a href="${ctx}/admin/company/enable/${company.id}">启用</a>&nbsp;&nbsp;
        </c:otherwise>
        </c:choose>
            <a href="${ctx}/admin/company/${company.id}/account">账号</a>&nbsp;&nbsp;
            <a href="${ctx}/admin/company/deposit/${company.id}">充值</a></td>
      </tr>
    </c:forEach>
    </tbody>
  </table>
  
  <tags:pagination page="${companys}" paginationSize="5"/>

  <div><a class="btn" href="${ctx}/admin/company/create">创建公司</a></div>
</body>
</html>
